package com.neuedu.controller.admin;

import com.github.pagehelper.PageInfo;
import com.neuedu.bean.User;
import com.neuedu.bean.VO.UserVO;
import com.neuedu.common.R;
import com.neuedu.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
// 2. 设置该模块的请求路径，如/user
@RequestMapping("/admin/user")
// 3. 解决跨域
@CrossOrigin
public class AdminUserController {
    @Autowired
    private UserService userService;
    @PostMapping("/queryUserPageList/{pageNum}/{pageSize}")
    public R queryUserPageList(@PathVariable( "pageNum") int pageNum,
                               @PathVariable("pageSize") int pageSize,
                               @RequestBody( required = false) UserVO userVO) {

        List<User> userList=userService.queryUserPageList(pageNum, pageSize, userVO);
        PageInfo<User> pageInfo= new PageInfo<>( userList);
        return R.ok().data(pageInfo);
    }
}
